/**
 * User: c3t
 * Date: 13-12-12
 * Time: 下午1:02
 */
/**
 *使用xpath得到想要的节点集合，采用工厂方法解决ie，firefox不兼容
 *  root:xml文档
 *  path:查找所需要的节点的xpath
 */
define(function() {
    function getNodesByPath(root,path){
        if(window.ActiveXObject) {
            return root.selectNodes(path);
        }else if(XPathResult){
            var ns = new Array();
            var xr = root.evaluate(path,root,null,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);
            var node = null;
            while((node=xr.iterateNext())) {
                ns.push(node);
            }
            return ns;
        }else{
            alert("请更换主流浏览器");
            return null;
        }

    }
    return {getNodesByPath:getNodesByPath};
});
